#ifndef LINKED_LIST_COMMON_H
#define LINKED_LIST_COMMON_H
class linked_list
{
private:
    struct node; // 声明结构体
    node *head;  // 链表头指针
    node *tail;  // 链表尾指针
    int size;    // 链表大小
public:
    linked_list();
    ~linked_list();
    void init();
    void insert_head(linked_list *list, void *data);
    void insert_tail(linked_list *list, void *data);
    void insert_middle(linked_list *list, void *data, int position);
    void delete_head(linked_list *list);
    void delete_tail(linked_list *list);
    void delete_middle(linked_list *list, int position);
    void update_middle(linked_list *list, void *data, int position);
    void print_forward(linked_list *list);
    void print_backward(linked_list *list);
    int get_size(linked_list *list);
    void clear(linked_list *list);
};
#endif